package com.xc.stock.constant;

/**
 * @author xlfd
 * @email xlfd@gmail.com
 * @version 1.0
 * @created Jan 13, 2021 11:53:31 AM
 */
public enum AccountActionEnum {
	SETTLEMENT("SETTLEMENT", "INCOME", "结算"),
	COMMISSION_SETTLEMENT("COMMISSION_SETTLEMENT","INCOME", "佣金结算"),
	FLOATING_SETTLEMENT("FLOATING_SETTLEMENT","INCOME", "浮动费结算"),
	DELIVERY_SETTLEMENT("DELIVERY_SETTLEMENT", "INCOME", "配送费结算"), 
	WITHDRAWAL("WITHDRAWAL", "WITHDRAWAL", "提现"), 
	
	ORDER("ORDER", "INCOME", "订单"), 
	RECHARGE("RECHARGE", "RECHARGE", "充值"), 
	BAIL_RECHARGE("BAIL_RECHARGE", "BAIL_RECHARGE", "保证金充值"), 
	TRUST_BUY("TRUST_BUY", "TRUST_BUY", "买入冻结金额"), 
	TRUST_SELL("TRUST_SELL", "TRUST_SELL", "委托卖出"), 
	TRUST_SELL_ATTACH_BAIL("TRUST_SELL_ATTACH_BAIL", "TRUST_SELL_ATTACH_BAIL", "委托卖出附带保证金"), 
//	TRUST_BUY_UNDO("TRUST_BUY_UNDO", "TRUST_BUY_UNDO", "委托买入撤销"), 
	TRANSFER_OUT("TRANSFER_OUT", "TRANSFER_OUT", "兑换转出"), 
	TRANSFER_IN("TRANSFER_IN", "TRANSFER_IN", "兑换转入"),
	
	PRE_TRADING_DAY("PRE_TRADING_DAY", "PRE_TRADING_DAY", "融资利息费"), 
	IPO_SUBSCRIBE("IPO_SUBSCRIBE", "IPO_SUBSCRIBE", "申购"), 
	;

	String code;
	String type;
	String remark;
	AccountActionEnum(String code, String type, String remark) {
		this.code = code;
		this.remark = remark;
		this.type = type;
	}

	public String code() {
		return code;
	}
	
	public String type() {
		return type;
	}

	public String remark() {
		return remark;
	}

	public static AccountActionEnum of(String code) {
		AccountActionEnum[] values = AccountActionEnum.values();
		for (AccountActionEnum e : values) {
			if (e.code.equals(code)) {
				return e;
			}
		}

		return null;
	}

	public static String remark(String code) {
		AccountActionEnum of = of(code);
		return of == null? "" : of.remark;
	}
}
